#include <platLogPrintf.h>
int MCU_XDATA_TYPE logLevelParam = logLevelTrace;
uint8_t MCU_XDATA_TYPE deviceCommString[DEVICE_MCU_COMMON_STR_SIZE];
void systemPrintf(char *format, ...)
{
    int tmpsize;
    va_list vArgList;
    va_start(vArgList, format);
#if DEVICE_PLATFORM_CONFIGURE != DEVICE_PLATFORM_C51_MCU
    tmpsize = vsnprintf((char *)deviceCommString, sizeof(deviceCommString), format, vArgList);
#else
    tmpsize = vsprintf((char *)deviceCommString, format, vArgList);
#endif
    va_end(vArgList);
#if DEVICE_PLATFORM_CONFIGURE == DEVICE_PLATFORM_LINUX
    printf("%s", deviceCommString);
#elif DEVICE_PLATFORM_CONFIGURE == DEVICE_PLATFORM_C99_MCU
    // ===coding by user self===
    uartSendStr(DEVICE_MCU_DEBUG_UART, deviceCommString, tmpsize);
#elif DEVICE_PLATFORM_CONFIGURE == DEVICE_PLATFORM_C51_MCU
    // ===coding by user self===
    // uartSendStr(DEVICE_MCU_DEBUG_UART, deviceCommString, tmpsize);
#endif
}
#if DEVICE_PLATFORM_CONFIGURE == DEVICE_PLATFORM_C51_MCU
void logerror(char *format, ...)
{
    int tmpsize;
    va_list vArgList;
    if(logLevelParam >= logLevelError)
    {
        return;
    }
    va_start(vArgList, format);
    tmpsize = vsprintf((char *)deviceCommString, format, vArgList);
    va_end(vArgList);
    // ===coding by user self===
    //uartSendStr(DEVICE_MCU_DEBUG_UART, deviceCommString, tmpsize);    
}
void logdebug(char *format, ...)
{
    int tmpsize;
    va_list vArgList;
    if(logLevelParam >= logLevelDebug)
    {
        return;
    }
    va_start(vArgList, format);
    tmpsize = vsprintf((char *)deviceCommString, format, vArgList);
    va_end(vArgList);
    // ===coding by user self===
    //uartSendStr(DEVICE_MCU_DEBUG_UART, deviceCommString, tmpsize);    
}
#endif
